package com.example.config.rabbit;

import com.example.enums.QueueEnum;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.AmqpException;
import org.springframework.amqp.core.*;

import org.springframework.amqp.support.converter.AbstractJavaTypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
@Slf4j
public class SendMessage {
    @Autowired
    AmqpTemplate amqpTemplate;  //使用RabbitTemplate,这提供了接收/发送等等方法

    public void send(Integer orderId) {
        amqpTemplate.convertAndSend(QueueEnum.QUEUE_TTL_ORDER_CANCEL.getExchange(), QueueEnum.QUEUE_TTL_ORDER_CANCEL.getRouteKey(),
                orderId);
    }

}
